package top.minuy.structure.graph.route.euler;

import top.minuy.res.graph.GraphRes;
import top.minuy.structure.graph.representations.table.Graph;

/**
 * 测试欧拉回路
 *
 * @author Minuy
 * @time 21:01
 * @date 2021/11/24
 */
public class Test {

    public static void main(String[] args) {

        System.out.println("无向图：");
        Graph g1 = new Graph(GraphRes.G_EULER_1);
        System.out.println("-> E1 : ");
        testUndirected(g1);
        System.out.println("-> E2 : ");
        Graph g2 = new Graph(GraphRes.G_EULER_2);
        testUndirected(g2);


        System.out.println("有向图：");
        System.out.println("-> E3 : ");
        Graph g3 = new Graph(GraphRes.G_DIRECTED_EULER_LOOP_01,true);
        testDirected(g3);
        System.out.println("-> E4 : ");
        Graph g4 = new Graph(GraphRes.G_DIRECTED_EULER_LOOP_02,true);
        testDirected(g4);
    }

    private static void testUndirected(Graph g) {
        EulerLoop el = new EulerLoop(g);
        EulerDetection ed = new EulerDetection(g);
        System.out.println("Has EulerLoop : "+ed);
        System.out.println(el);
    }

    private static void testDirected(Graph g) {
        DirectedEulerLoop de = new DirectedEulerLoop(g);
        System.out.println("Has EulerLoop : "+de.hasEulerLoop());
        System.out.println(de);
    }
}
